[Confluence] Server attach_content: always POST to update an attachment - #1687
Merged
gonchik merged 1 commit intoOct 3, 2026
Merged
Conversation
The update branch only used POST when api_version was "1.0", but Server now defaults to "latest", so updating an existing attachment went to the PUT path that Server doesn't support. Fixes atlassian-api#1681
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1687 +/- ##
==========================================
+ Coverage 65.16% 65.21% +0.04%
==========================================
Files 106 106
Lines 19210 19207 -3
Branches 2086 2085 -1
==========================================
+ Hits 12518 12525 +7
+ Misses 6004 5995 -9
+ Partials 688 687 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1681
#1679 put the POST-to-
/datapath back for updating an existing attachment, but only whenapi_version == "1.0".ConfluenceServernow defaults toapi_version="latest", so with default settings an update still went to the PUT branch, which Server/Data Center doesn't support.The Server class now always updates an existing attachment with
POST rest/api/content/{page_id}/child/attachment/{attachment_id}/dataand the PUT branch is gone. Creating a new attachment is unchanged. I went with the option suggested in the issue, since this method lives only on the Server class; the Cloud client is a separate class and never goes through it.How I tested:
test_attach_content_updates_existing_attachment_with_post, parametrized over the default,"latest"and"1.0". On master the default and"latest"cases fail (PUT is called); with the change all three pass.pytest: 1723 passed, 10 skipped.confluence/server. mypy shows the same 12 existing errors as master, none in this file.